Skip to content

perf: marker rendering optimisations — memoize pilot and airport markers#18

Merged
o4oren merged 9 commits into
mainfrom
perf/marker-rendering-optimisations
Apr 8, 2026
Merged

perf: marker rendering optimisations — memoize pilot and airport markers#18
o4oren merged 9 commits into
mainfrom
perf/marker-rendering-optimisations

Conversation

@o4oren

@o4oren o4oren commented Apr 8, 2026

Copy link
Copy Markdown
Owner

Summary

  • Eliminate redundant per-poll work in PilotMarkers and AirportMarkers so unchanged markers cost near-zero reconciliation on every 20-second VATSIM data update
  • Role and aircraft image resolution moved inside PilotMarkerItem so React.memo gates the work — stationary pilots with unchanged aircraft/role skip re-render entirely
  • Airport markers loop (including TRACON polygons and APP circles) wrapped in useMemo so getAirportByCode, lookupTracon, and Skia image renders only run when data actually changes
  • Dead code (ClusteredPilotMarkers) removed

Changes

  • PilotMarkers.jsx — role/image resolution moved into child, filter+map memoized, named selector to fix Redux stability warning
  • AirportMarkers.jsx — entire markers computation wrapped in useMemo, onPress stabilized with useCallback
  • LocalAirportMarker.jsx — custom React.memo equality comparator (checks atcList callsigns, traffic counts, theme)
  • CTRPolygons.jsxonPress stabilized with useCallback
  • ClusteredPilotMarkers.jsx — deleted (unused, stale implementation)
  • __tests__/PilotMarkers.test.js — updated equality tests for new prop API

Test Plan

  • Open map view — pilot markers render correctly at all zoom levels
  • ATC markers and TRACON polygons render for active controllers
  • Tap a pilot — detail panel opens, tap again closes
  • Change theme — pilot icon colors update correctly
  • Add a friend CID in settings — friend marker color updates
  • No JS-only changes — OTA update sufficient, no native rebuild needed

Notes

Pure JS changes — no native modules touched. OTA-deployable.
Follow-up candidates (deferred): iOS marker rendering pipeline (child <Image> → native image prop), viewport culling for high-density events.

@o4oren o4oren merged commit d352fa0 into main Apr 8, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant